<?php /*a:2:{s:63:"/www/wwwroot/cloud_boss/application/admin/view/company/add.html";i:1605795886;s:64:"/www/wwwroot/cloud_boss/application/admin/view/public/basic.html";i:1573743224;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo htmlentities((isset($title) && ($title !== '')?$title:'重庆优合一众')); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/plugs/layui/css/layui.css" media="all"/>
    <!--<link rel="stylesheet" href="/static/layuicms/css/index.css" media="all" />-->
    
</head>
<body class="<?php echo htmlentities((isset($body) && ($body !== '')?$body:'childrenBody')); ?>">

<form class="layui-form" style="width:80%;">
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息</li>
            <li>用户端小程序配置</li>
            <li>推广端小程序配置</li>
            <li>工程端小程序配置</li>
            <li>微信公众号配置</li>
            <li>图片配置</li>
            <li class="configModular">e签宝配置</li>
            <li class="configModular">合同模板</li>
            <li>短信配置</li>
            <li>支付配置</li>
        </ul>

        <div class="layui-tab-content ">
            <!--基本信息-->
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">应用</label>
                    <div class="layui-input-block">
                        <select name="app_sn" class="app_sn" id="app_sn" lay-filter="selectCompany">
                            <?php foreach($applications as $k=>$v): ?>
                            <option value="<?php echo htmlentities($v['app_sn']); ?>" <?php if($data && $data['app_sn'] == $v['app_sn']): ?>selected<?php endif; ?>><?php echo htmlentities($v['name']); ?></option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">企业编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="company_no" class="layui-input company_no" value="<?php echo htmlentities((isset($data['company_no']) && ($data['company_no'] !== '')?$data['company_no']:'')); ?>" placeholder="请输入企业编号,一旦生成不能更改" <?php if($data && $data['company_no']): ?>disabled<?php endif; ?>>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">企业名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="company_name" class="layui-input company_name" lay-verify="required" value="<?php echo htmlentities((isset($data['company_name']) && ($data['company_name'] !== '')?$data['company_name']:'')); ?>" placeholder="请输入企业名称">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">企业简称</label>
                    <div class="layui-input-block">
                        <input type="text" name="short_name_en" class="layui-input short_name_en" value="<?php echo htmlentities((isset($data['short_name_en']) && ($data['short_name_en'] !== '')?$data['short_name_en']:'')); ?>" placeholder="请输入企业英文简称,一旦生成不能更改" <?php if($data && $data['short_name_en']): ?>disabled<?php endif; ?>>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">账号</label>
                    <div class="layui-input-block">
                        <input type="text" name="admin_account" class="layui-input admin_account" value="<?php echo htmlentities((isset($data['account']) && ($data['account'] !== '')?$data['account']:'')); ?>" placeholder="请输入总后台登陆账号，不填系统自动生成">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">初始密码</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" type="password" name="admin_password" class="layui-input admin_password" lay-verify="required" placeholder="请输入初始密码，默认123456">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">确认密码</label>
                    <div class="layui-input-block">
                        <input autocomplete="off" type="password" name="admin_password1" class="layui-input admin_password1" lay-verify="required" placeholder="请输入确认密码">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">营业执照编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="business_license_pic" class="layui-input business_license_pic" value="<?php echo htmlentities((isset($data['business_license_pic']) && ($data['business_license_pic'] !== '')?$data['business_license_pic']:'')); ?>" placeholder="请输入营业执照编号">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">公章防伪码</label>
                    <div class="layui-input-block">
                        <input type="text" name="seal_code" class="layui-input seal_code" value="<?php echo htmlentities((isset($data['seal_code']) && ($data['seal_code'] !== '')?$data['seal_code']:'')); ?>" placeholder="请输入公章防伪码">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">企业电话</label>
                    <div class="layui-input-block">
                        <input type="text" name="telphone" maxlength="11" class="layui-input telphone" value="<?php echo htmlentities((isset($data['telphone']) && ($data['telphone'] !== '')?$data['telphone']:'')); ?>" placeholder="请输入企业电话">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">联系人</label>
                    <div class="layui-input-block">
                        <input type="email" name="contacts" class="layui-input contacts" value="<?php echo htmlentities((isset($data['contacts']) && ($data['contacts'] !== '')?$data['contacts']:'')); ?>" placeholder="请输入联系人">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">联系人电话</label>
                    <div class="layui-input-block">
                        <input type="text" name="contacts_tel" maxlength="11" class="layui-input contacts_tel" value="<?php echo htmlentities((isset($data['contacts_tel']) && ($data['contacts_tel'] !== '')?$data['contacts_tel']:'')); ?>" placeholder="请输入联系人电话">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">企业地址</label>
                    <div class="layui-input-block">
                        <input type="text" name="company_addr" class="layui-input company_addr" value="<?php echo htmlentities((isset($data['company_addr']) && ($data['company_addr'] !== '')?$data['company_addr']:'')); ?>" placeholder="请输入企业详细地址">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">备注信息</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入备注信息" name="remarks" class="layui-textarea remarks"><?php echo htmlentities((isset($data['remarks']) && ($data['remarks'] !== '')?$data['remarks']:'')); ?></textarea>
                    </div>
                </div>

                <?php if(!empty($data)): ?>
                <input type="hidden" class="id" name="id" value="<?php echo htmlentities((isset($data['company_id']) && ($data['company_id'] !== '')?$data['company_id']:'')); ?>">
                <?php endif; ?>
            </div>
            <!--用户端小程序配置-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">小程序名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="app_wx_name" class="layui-input wx_app_wx_name" lay-verify="required" value="<?php echo htmlentities((isset($data['wx_config']['app_wx_name']) && ($data['wx_config']['app_wx_name'] !== '')?$data['wx_config']['app_wx_name']:'')); ?>" placeholder="请输入小程序名称">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">APPID</label>
                    <div class="layui-input-block">
                        <input type="text" name="appId" class="layui-input wx_appId" value="<?php echo htmlentities((isset($data['wx_config']['appId']) && ($data['wx_config']['appId'] !== '')?$data['wx_config']['appId']:'')); ?>" placeholder="请输入APPID">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">AppSecret</label>
                    <div class="layui-input-block">
                        <input type="text" name="appSecret" class="layui-input wx_appSecret" value="<?php echo htmlentities((isset($data['wx_config']['appSecret']) && ($data['wx_config']['appSecret'] !== '')?$data['wx_config']['appSecret']:'')); ?>" lay-verify="required" placeholder="请输入AppSecret">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">商户号</label>
                    <div class="layui-input-block">
                        <input type="text" name="mchid" class="layui-input wx_mchid" value="<?php echo htmlentities((isset($data['wx_config']['mchid']) && ($data['wx_config']['mchid'] !== '')?$data['wx_config']['mchid']:'')); ?>" placeholder="请输入商户号">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">支付密钥</label>
                    <div class="layui-input-block">
                        <input type="text" name="pay_key" class="layui-input wx_pay_key" lay-verify="required" value="<?php echo htmlentities((isset($data['wx_config']['pay_key']) && ($data['wx_config']['pay_key'] !== '')?$data['wx_config']['pay_key']:'')); ?>" placeholder="请输入支付秘钥">
                    </div>
                </div>
            </div>
            <!--推广端小程序配置-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">小程序名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="app_wx_name" class="layui-input spread_app_wx_name" lay-verify="required" value="<?php echo htmlentities((isset($data['spread_wx_config']['app_wx_name']) && ($data['spread_wx_config']['app_wx_name'] !== '')?$data['spread_wx_config']['app_wx_name']:'')); ?>" placeholder="请输入小程序名称">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">APPID</label>
                    <div class="layui-input-block">
                        <input type="text" name="appId" class="layui-input spread_appId" value="<?php echo htmlentities((isset($data['spread_wx_config']['appId']) && ($data['spread_wx_config']['appId'] !== '')?$data['spread_wx_config']['appId']:'')); ?>" placeholder="请输入APPID">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">AppSecret</label>
                    <div class="layui-input-block">
                        <input type="text" name="appSecret" class="layui-input spread_appSecret" value="<?php echo htmlentities((isset($data['spread_wx_config']['appSecret']) && ($data['spread_wx_config']['appSecret'] !== '')?$data['spread_wx_config']['appSecret']:'')); ?>" lay-verify="required" placeholder="请输入AppSecret">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">商户号</label>
                    <div class="layui-input-block">
                        <input type="text" name="mchid" class="layui-input spread_mchid" value="<?php echo htmlentities((isset($data['spread_wx_config']['mchid']) && ($data['spread_wx_config']['mchid'] !== '')?$data['spread_wx_config']['mchid']:'')); ?>" placeholder="请输入商户号">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">支付密钥</label>
                    <div class="layui-input-block">
                        <input type="text" name="pay_key" class="layui-input spread_pay_key" lay-verify="required" value="<?php echo htmlentities((isset($data['spread_wx_config']['pay_key']) && ($data['spread_wx_config']['pay_key'] !== '')?$data['spread_wx_config']['pay_key']:'')); ?>" placeholder="请输入支付秘钥">
                    </div>
                </div>
            </div>
            <!--维修端-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">小程序名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="app_wx_name" class="layui-input engineer_app_wx_name" lay-verify="required" value="<?php echo htmlentities((isset($data['engineer_wx_config']['app_wx_name']) && ($data['engineer_wx_config']['app_wx_name'] !== '')?$data['engineer_wx_config']['app_wx_name']:'')); ?>" placeholder="请输入小程序名称">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">APPID</label>
                    <div class="layui-input-block">
                        <input type="text" name="appId" class="layui-input engineer_appId" value="<?php echo htmlentities((isset($data['engineer_wx_config']['appId']) && ($data['engineer_wx_config']['appId'] !== '')?$data['engineer_wx_config']['appId']:'')); ?>" placeholder="请输入APPID">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">AppSecret</label>
                    <div class="layui-input-block">
                        <input type="text" name="appSecret" class="layui-input engineer_appSecret" value="<?php echo htmlentities((isset($data['engineer_wx_config']['appSecret']) && ($data['engineer_wx_config']['appSecret'] !== '')?$data['engineer_wx_config']['appSecret']:'')); ?>" lay-verify="required" placeholder="请输入AppSecret">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">商户号</label>
                    <div class="layui-input-block">
                        <input type="text" name="mchid" class="layui-input engineer_mchid" value="<?php echo htmlentities((isset($data['engineer_wx_config']['mchid']) && ($data['engineer_wx_config']['mchid'] !== '')?$data['engineer_wx_config']['mchid']:'')); ?>" placeholder="请输入商户号">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">支付密钥</label>
                    <div class="layui-input-block">
                        <input type="text" name="pay_key" class="layui-input engineer_pay_key" lay-verify="required" value="<?php echo htmlentities((isset($data['engineer_wx_config']['pay_key']) && ($data['engineer_wx_config']['pay_key'] !== '')?$data['engineer_wx_config']['pay_key']:'')); ?>" placeholder="请输入支付秘钥">
                    </div>
                </div>

                <!--                <div class="layui-form-item layui-row layui-col-xs12">-->
                <!--                    <label class="layui-form-label">LOGO</label>-->
                <!--                    <div class="layui-input-block">-->
                <!--                        <input type="text" name="logo" class="layui-input engineer_logo" lay-verify="required" placeholder="请输入">-->
                <!--                    </div>-->
                <!--                </div>-->
            </div>
            <!--公众号-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">公众号名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="app_wx_name" class="layui-input mp_app_wx_name" lay-verify="required" value="<?php echo htmlentities((isset($data['mp_config']['app_wx_name']) && ($data['mp_config']['app_wx_name'] !== '')?$data['mp_config']['app_wx_name']:'')); ?>" placeholder="请输入公众号名称">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">APPID</label>
                    <div class="layui-input-block">
                        <input type="text" name="appId" class="layui-input mp_appId" value="<?php echo htmlentities((isset($data['mp_config']['appId']) && ($data['mp_config']['appId'] !== '')?$data['mp_config']['appId']:'')); ?>" placeholder="请输入公众号APPID">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">AppSecret</label>
                    <div class="layui-input-block">
                        <input type="text" name="appSecret" class="layui-input mp_appSecret" value="<?php echo htmlentities((isset($data['mp_config']['appSecret']) && ($data['mp_config']['appSecret'] !== '')?$data['mp_config']['appSecret']:'')); ?>" lay-verify="required" placeholder="请输入公众号AppSecret">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">商户号</label>
                    <div class="layui-input-block">
                        <input type="text" name="mchid" class="layui-input mp_mchid" value="<?php echo htmlentities((isset($data['mp_config']['mchid']) && ($data['mp_config']['mchid'] !== '')?$data['mp_config']['mchid']:'')); ?>" placeholder="请输入商户号">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">支付密钥</label>
                    <div class="layui-input-block">
                        <input type="text" name="pay_key" class="layui-input mp_pay_key" lay-verify="required" value="<?php echo htmlentities((isset($data['mp_config']['pay_key']) && ($data['mp_config']['pay_key'] !== '')?$data['mp_config']['pay_key']:'')); ?>" placeholder="请输入支付秘钥">
                    </div>
                </div>
            </div>

            <!--图片配置-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">小程序图片</label>
                    <div class="layui-col-md3 layui-col-xs5">
                        <input type="hidden" name="image" class="image" value="<?php echo htmlentities((isset($data['img_config']['image']) && ($data['img_config']['image'] !== '')?$data['img_config']['image']:'')); ?>"/>
                        <div class="layui-upload-list thumbBox mag0 magt3">
                            <img class="layui-upload-img thumbImg" style="width: 130px;height: 60px"
                                 src="<?php echo config('api.qi_niu_url'); ?><?php echo htmlentities((isset($data['img_config']['image']) && ($data['img_config']['image'] !== '')?$data['img_config']['image']:'')); ?>"
                                 onerror="javascript:this.src='/static/image/admin/nopic.png'">
                            <input type="file" name="picture" id="picture" multiple="multiple"
                                   onchange="uploadFile('picture')" accept="image/jpg,image/jpeg,image/png"/>
                        </div>
                        <div class="tips">推荐尺寸:260px*120px;使用位置:工程端登录页</div>
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">后台图片</label>
                    <div class="layui-col-md3 layui-col-xs5">
                        <input type="hidden" name="admin_image" class="admin_image"
                               value="<?php echo htmlentities((isset($data['img_config']['admin_image']) && ($data['img_config']['admin_image'] !== '')?$data['img_config']['admin_image']:'')); ?>"/>
                        <div class="layui-upload-list thumbBox mag0 magt3">
                            <img class="layui-upload-img adminImg" style="width: 100%;height: 60px"
                                 src="<?php echo config('api.qi_niu_url'); ?><?php echo htmlentities((isset($data['img_config']['admin_image']) && ($data['img_config']['admin_image'] !== '')?$data['img_config']['admin_image']:'')); ?>"
                                 onerror="javascript:this.src='/static/image/admin/nopic.png'">
                            <input type="file" name="adminImg" id="adminImg" multiple="multiple"
                                   onchange="uploadFiles('adminImg')" accept="image/jpg,image/jpeg,image/png"/>
                        </div>
                    </div>
                </div>

            </div>
            <!--e签宝配置-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">企业名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="esign_name" class="layui-input esign_name" lay-verify="required"
                               value="<?php echo htmlentities((isset($data['esign_config']['name']) && ($data['esign_config']['name'] !== '')?$data['esign_config']['name']:'')); ?>" placeholder="请输入企业名称">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">单位类型</label>
                    <div class="layui-input-block">
                        <select name="esign_organType" class="esign_organType">
                            <option value="0" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['organType'] == 0): ?>selected<?php endif; ?>>普通企业</option>
                            <option value="1" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['organType'] == 1): ?>selected<?php endif; ?>>社会团体</option>
                            <option value="2" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['organType'] == 2): ?>selected<?php endif; ?>>事业单位</option>
                            <option value="3" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['organType'] == 3): ?>selected<?php endif; ?>>民办非企业单位</option>
                            <option value="4" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['organType'] == 4): ?>selected<?php endif; ?>>党政及国家机构</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">组织机构代码号或社会信用代码号或工商注册号</label>
                    <div class="layui-input-block">
                        <input type="text" name="esign_organCode" class="layui-input esign_organCode"
                               value="<?php echo htmlentities((isset($data['esign_config']['organCode']) && ($data['esign_config']['organCode'] !== '')?$data['esign_config']['organCode']:'')); ?>" placeholder="请输入组织机构代码号或社会信用代码号或工商注册号">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">证件类型</label>
                    <div class="layui-input-block">
                        <select name="esign_regType" class="esign_regType">
                            <option value="0" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['regType'] == 0): ?>selected<?php endif; ?>>组织机构代码号</option>
                            <option value="1" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['regType'] == 1): ?>selected<?php endif; ?>>三证合一营业执照</option>
                            <option value="2" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['regType'] == 2): ?>selected<?php endif; ?>>工商注册号</option>
                            <option value="23" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['regType'] == 23): ?>selected<?php endif; ?>>其他</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">手机</label>
                    <div class="layui-input-block">
                        <input type="text" name="esign_mobile" class="layui-input esign_mobile"
                               value="<?php echo htmlentities((isset($data['esign_config']['mobile']) && ($data['esign_config']['mobile'] !== '')?$data['esign_config']['mobile']:'')); ?>" placeholder="请输入手机">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-block">
                        <input type="text" name="esign_email" class="layui-input esign_email"
                               value="<?php echo htmlentities((isset($data['esign_config']['email']) && ($data['esign_config']['email'] !== '')?$data['esign_config']['email']:'')); ?>" placeholder="请输入邮箱">
                    </div>
                </div>

                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">注册类型</label>
                    <div class="layui-input-block">
                        <select name="esign_userType" class="esign_userType">
                            <option value="2" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['userType'] == 2): ?>selected<?php endif; ?>>法人</option>
                            <option value="1" <?php if(!empty($data) && !empty($data['esign_config'])  && $data['esign_config']['userType'] == 1): ?>selected<?php endif; ?>>代理人</option>
                            <option value="0" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['userType'] == 0): ?>selected<?php endif; ?>>不注册法人/代理人</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">代理人姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="esign_agentName" class="layui-input esign_agentName"
                               value="<?php echo htmlentities((isset($data['esign_config']['agentName']) && ($data['esign_config']['agentName'] !== '')?$data['esign_config']['agentName']:'')); ?>" placeholder="请输入代理人姓名">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">代理人证件号</label>
                    <div class="layui-input-block">
                        <input type="text" name="esign_agentIdNo" class="layui-input esign_agentIdNo"
                               value="<?php echo htmlentities((isset($data['esign_config']['agentIdNo']) && ($data['esign_config']['agentIdNo'] !== '')?$data['esign_config']['agentIdNo']:'')); ?>" placeholder="请输入代理人证件号">
                        <div style="color:red">注意：必须是真实的证件号码！</div>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">法人姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="esign_legalName" class="layui-input esign_legalName"
                               value="<?php echo htmlentities((isset($data['esign_config']['legalName']) && ($data['esign_config']['legalName'] !== '')?$data['esign_config']['legalName']:'')); ?>" placeholder="请输入法人姓名">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">法人证件号</label>
                    <div class="layui-input-block">
                        <input type="text" name="esign_legalIdNo" class="layui-input esign_legalIdNo" value="<?php echo htmlentities((isset($data['esign_config']['legalIdNo']) && ($data['esign_config']['legalIdNo'] !== '')?$data['esign_config']['legalIdNo']:'')); ?>" placeholder="请输入法人证件号">
                        <div style="color:red">注意：必须是真实的证件号码！</div>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">法人归属地</label>
                    <div class="layui-input-block">
                        <select name="esign_legalArea" class="esign_legalArea">
                            <option value="0" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['legalArea'] == 0): ?>selected<?php endif; ?>>大陆</option>
                            <!-- <option value="1" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['legalArea'] == 1): ?>selected<?php endif; ?>>香港</option>
                             <option value="2" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['legalArea'] == 2): ?>selected<?php endif; ?>>澳门</option>
                             <option value="3" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['legalArea'] == 3): ?>selected<?php endif; ?>>台湾</option>
                             <option value="4" <?php if(!empty($data) && !empty($data['esign_config']) && $data['esign_config']['legalArea'] == 4): ?>selected<?php endif; ?>>外籍</option>-->
                        </select>
                    </div>
                </div>
            </div>
            <!--e签宝配置-->

            <!--合同配置-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">新装购买合同模板</label>
                    <div class="layui-col-md3 layui-col-xs5">
                        <input type="hidden" name="admin_image1" class="admin_image1"
                               value="<?php echo htmlentities((isset($data['img_config']['admin_file1']) && ($data['img_config']['admin_file1'] !== '')?$data['img_config']['admin_file1']:'')); ?>"/>
                        <div class="layui-upload-list thumbBox mag0 magt3">
                            <div class="adminImg1"><?php echo htmlentities((isset($data['img_config']['admin_file1']) && ($data['img_config']['admin_file1'] !== '')?$data['img_config']['admin_file1']:'')); ?></div>
                            <input type="file" name="adminImg1" id="adminImg1" multiple="multiple"
                                   onchange="uploadFiles1('adminImg1')"/>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">新装租赁合同模板</label>
                    <div class="layui-col-md3 layui-col-xs5">
                        <input type="hidden" name="admin_image2" class="admin_image2"
                               value="<?php echo htmlentities((isset($data['img_config']['admin_file2']) && ($data['img_config']['admin_file2'] !== '')?$data['img_config']['admin_file2']:'')); ?>"/>
                        <div class="layui-upload-list thumbBox mag0 magt3">
                            <div class="adminImg2"><?php echo htmlentities((isset($data['img_config']['admin_file2']) && ($data['img_config']['admin_file2'] !== '')?$data['img_config']['admin_file2']:'')); ?></div>
                            <input type="file" name="adminImg2" id="adminImg2" multiple="multiple"
                                   onchange="uploadFiles2('adminImg2')"/>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">移机合同模板</label>
                    <div class="layui-col-md3 layui-col-xs5">
                        <input type="hidden" name="admin_image3" class="admin_image3"
                               value="<?php echo htmlentities((isset($data['img_config']['admin_file3']) && ($data['img_config']['admin_file3'] !== '')?$data['img_config']['admin_file3']:'')); ?>"/>
                        <div class="layui-upload-list thumbBox mag0 magt3">
                            <div class="adminImg3"><?php echo htmlentities((isset($data['img_config']['admin_file3']) && ($data['img_config']['admin_file3'] !== '')?$data['img_config']['admin_file3']:'')); ?></div>
                            <input type="file" name="adminImg3" id="adminImg3" multiple="multiple"
                                   onchange="uploadFiles3('adminImg3')"/>
                        </div>
                    </div>
                </div>
            </div>
            <!---->
            <!--短信配置-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">账号</label>
                    <div class="layui-input-block">
                        <input type="text" name="sms_uid" class="layui-input sms_uid" lay-verify="required"
                               value="<?php echo htmlentities((isset($data['sms_config']['uid']) && ($data['sms_config']['uid'] !== '')?$data['sms_config']['uid']:'')); ?>" placeholder="请输入短信账号">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="text" name="sms_passwd" class="layui-input sms_passwd" lay-verify="required"
                               value="<?php echo htmlentities((isset($data['sms_config']['passwd']) && ($data['sms_config']['passwd'] !== '')?$data['sms_config']['passwd']:'')); ?>" placeholder="请输入短信密码">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">内容</label>
                    <div class="layui-input-block">
                        <input type="text" name="sms_content" class="layui-input sms_content" lay-verify="required"
                               value="<?php echo htmlentities((isset($data['sms_config']['content']) && ($data['sms_config']['content'] !== '')?$data['sms_config']['content']:'')); ?>" placeholder="请输入短信内容">
                    </div>
                </div>
            </div>
            <!---->
            <!--支付配置-->
            <div class="layui-tab-item">
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">模式</label>
                    <div class="layui-input-block ">
                        <input type="radio" name="mode" value="1" title="普通商户模式" <?php if(empty($data) || ($data && $data['pay_config'] && $data['pay_config']['mode'] == 1)): ?>checked<?php endif; ?>>
                        <input type="radio" name="mode" value="2" title="服务商模式" <?php if($data && $data['pay_config'] && $data['pay_config']['mode'] == 2): ?>checked<?php endif; ?>>
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">子商户号</label>
                    <div class="layui-input-block">
                        <input type="text" name="sub_mch_id" class="layui-input sub_mch_id" lay-verify=""
                               value="<?php echo htmlentities((isset($data['pay_config']['sub_mch_id']) && ($data['pay_config']['sub_mch_id'] !== '')?$data['pay_config']['sub_mch_id']:'')); ?>" placeholder="请输入子商户账号,服务商模式必填">
                    </div>
                </div>
            </div>
            <!---->

        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-sm" lay-submit="" id="addUser">确定</button>
            <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">取消</button>
        </div>
    </div>
    </div>
</form>

<script type="text/javascript" src="/static/plugs/jquery/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="/static/plugs/layui/layui.js"></script>
<script type="text/javascript" src="/static/admin.js"></script>
<script type="text/javascript" src="/static/js/admin/api.js"></script>

<script>
    var flag = false;
    layui.use('element', function () {
        var element = layui.element;
        //一些事件监听
        element.on('tab(demo)', function (data) {
            console.log(data);
        });
    });

    layui.use(['form', 'layer'], function () {
        var form = layui.form;
        layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery;

        // 监听选择应用
        form.on('select(selectCompany)', function (data) {
            var app_sn = $(data.elem).find("option:selected").val();
            $("#app_sn").val(app_sn);

            if(app_sn=='water2018'){
                $(".configModular").hide();//隐藏合同和e签宝板块
            }else{
                $(".configModular").show();
            }
            form.render();
        });

        /**
         * 新增以及编辑后台用户
         */
        $("#addUser").click(function () {
            if (flag) {
                return false;
            }
            flag = true;
            var data = {
                id: $(".id").val(),
                company_name: $(".company_name").val(),
                company_no: $(".company_no").val(),
                short_name_en: $(".short_name_en").val(),
                app_sn: $(".app_sn").val(),
                admin_account: $(".admin_account").val(),
                admin_password: $(".admin_password").val(),
                admin_password1: $(".admin_password1").val(),
                business_license_pic: $(".business_license_pic").val(),
                seal_code: $(".seal_code").val(),
                telphone: $(".telphone").val(),
                contacts: $(".contacts").val(),
                contacts_tel: $(".contacts_tel").val(),
                company_addr: $(".company_addr").val(),
                remarks: $(".remarks").val(),
                wx_config: {
                    app_wx_name: $(".wx_app_wx_name").val(),
                    appId: $(".wx_appId").val(),
                    appSecret: $(".wx_appSecret").val(),
                    mchid: $(".wx_mchid").val(),
                    pay_key: $(".wx_pay_key").val(),
                },
                spread_wx_config: {
                    app_wx_name: $(".spread_app_wx_name").val(),
                    appId: $(".spread_appId").val(),
                    appSecret: $(".spread_appSecret").val(),
                    mchid: $(".spread_mchid").val(),
                    pay_key: $(".spread_pay_key").val(),
                },
                engineer_wx_config: {
                    app_wx_name: $(".engineer_app_wx_name").val(),
                    appId: $(".engineer_appId").val(),
                    appSecret: $(".engineer_appSecret").val(),
                    mchid: $(".engineer_mchid").val(),
                    pay_key: $(".engineer_pay_key").val(),
                },
                mp_config: {
                    app_wx_name: $(".mp_app_wx_name").val(),
                    appId: $(".mp_appId").val(),
                    appSecret: $(".mp_appSecret").val(),
                    mchid: $(".mp_mchid").val(),
                    pay_key: $(".mp_pay_key").val(),
                },
                img_config: {
                    image: $(".image").val(),
                    admin_image: $(".admin_image").val(),
                    admin_file1: $(".admin_image1").val(),
                    admin_file2: $(".admin_image2").val(),
                    admin_file3: $(".admin_image3").val(),
                },
                esign_config: {
                    name: $(".esign_name").val(),
                    organCode: $(".esign_organCode").val(),
                    regType: $(".esign_regType").val(),
                    mobile: $(".esign_mobile").val(),
                    email: $(".esign_email").val(),
                    organType: $(".esign_organType").val(),
                    userType: $(".esign_userType").val(),
                    agentName: $(".esign_agentName").val(),
                    agentIdNo: $(".esign_agentIdNo").val(),
                    legalName: $(".esign_legalName").val(),
                    legalArea: $(".esign_legalArea").val(),
                    legalIdNo: $(".esign_legalIdNo").val(),
                },
                sms_config: {
                    uid: $(".sms_uid").val(),
                    passwd: $(".sms_passwd").val(),
                    content: $(".sms_content").val(),
                },
                pay_config: {
                    mode: $('input[name="mode"]:checked').val(),
                    sub_mch_id: $(".sub_mch_id").val(),
                }
            };
            var url = '<?php if(empty($data)): ?>/Api/Company/add<?php else: ?>/Api/Company/edit<?php endif; ?>';
            $.ajax({
                method: "POST",
                url: url,
                // url: '/Api/Company/add',
                contentType: 'application/json; charset=UTF-8',
                header: {
                    'token': "bbbb", // 默认值
                },
                dataType: 'json',
                data: JSON.stringify(data),
                success: (data) => {
                    console.log(data)
                    flag = false;
                    if (data.code == 0) {
                        layer.msg(data.msg, {icon: 1});
                        setTimeout(function () {
                            //刷新父页面
                            parent.location.reload();
                            // location.href='<?php echo url("$thisClass/index"); ?>';
                        }, 500)
                    } else {
                        layer.msg(data.msg, {icon: 2}, function () {
                            layer.close();
                        });
                    }

                },
                error: () => {
                    layer.msg('系统错误，请稍后再试', {icon: 2}, function () {
                        // tableIns.reload();
                    });
                    flag = false;
                }
            })

            return false;
        });

    })

    // 上传图片11
    function uploadFile(inputName) {
        var data = new FormData();
        $.each($('input[name="' + inputName + '"]')[0].files, function (i, file) {
            data.append('file', file);

        });
        //console.log(data.get(inputName))
        //清空图片
        $('#' + inputName).val('');
        //提交数据
        $.ajax({
            url: "<?php echo url('api/Upload/uploadFile'); ?>",
            type: 'POST',
            data: data,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            // dataType: 'json',
            success: function (res) {
                if (res.code == 1000) {
                    $('.thumbImg').attr('src', res.data.all_url);
                    $("input[name='image']").val(res.data.url);
                }
            },
            error: function (returndata) {
                parent.layer.msg('数据异常', {
                    icon: 2,
                    time: 2000
                });
                return false;
            }
        });
    }

    // 上传图片22
    function uploadFiles(inputName) {
        var data = new FormData();
        $.each($('input[name="' + inputName + '"]')[0].files, function (i, file) {
            data.append('file', file);

        });
        //console.log(data.get(inputName))
        //清空图片
        $('#' + inputName).val('');
        //提交数据
        $.ajax({
            url: "<?php echo url('api/Upload/uploadFile'); ?>",
            type: 'POST',
            data: data,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            // dataType: 'json',
            success: function (res) {
                if (res.code == 1000) {
                    $('.adminImg').attr('src', res.data.all_url);
                    $("input[name='admin_image']").val(res.data.url);
                }
            },
            error: function (returndata) {
                parent.layer.msg('数据异常', {
                    icon: 2,
                    time: 2000
                });
                return false;
            }
        });
    }

    // 上传新装购买合同模板
    function uploadFiles1(inputName) {
        var data = new FormData();
        $.each($('input[name="' + inputName + '"]')[0].files, function (i, file) {
            data.append('file', file);

        });
        //console.log(data.get(inputName))
        //清空图片
        $('#' + inputName).val('');
        //提交数据
        $.ajax({
            url: "<?php echo url('api/Upload/uploadFile'); ?>",
            type: 'POST',
            data: data,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            // dataType: 'json',
            success: function (res) {
                if (res.code == 1000) {
                    $('.adminImg1').html(res.data.all_url + '上传成功！');
                    $("input[name='admin_image1']").val(res.data.url);
                }
            },
            error: function (returndata) {
                parent.layer.msg('数据异常', {
                    icon: 2,
                    time: 2000
                });
                return false;
            }
        });
    }

    // 上传新装租赁合同模板
    function uploadFiles2(inputName) {
        var data = new FormData();
        $.each($('input[name="' + inputName + '"]')[0].files, function (i, file) {
            data.append('file', file);

        });
        //console.log(data.get(inputName))
        //清空图片
        $('#' + inputName).val('');
        //提交数据
        $.ajax({
            url: "<?php echo url('api/Upload/uploadFile'); ?>",
            type: 'POST',
            data: data,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            // dataType: 'json',
            success: function (res) {
                if (res.code == 1000) {
                    $('.adminImg2').html(res.data.all_url + '上传成功！');
                    $("input[name='admin_image2']").val(res.data.url);
                }
            },
            error: function (returndata) {
                parent.layer.msg('数据异常', {
                    icon: 2,
                    time: 2000
                });
                return false;
            }
        });
    }

    // 上传移机合同模板
    function uploadFiles3(inputName) {
        var data = new FormData();
        $.each($('input[name="' + inputName + '"]')[0].files, function (i, file) {
            data.append('file', file);

        });
        //console.log(data.get(inputName))
        //清空图片
        $('#' + inputName).val('');
        //提交数据
        $.ajax({
            url: "<?php echo url('api/Upload/uploadFile'); ?>",
            type: 'POST',
            data: data,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            // dataType: 'json',
            success: function (res) {
                if (res.code == 1000) {
                    $('.adminImg3').html(res.data.all_url + '上传成功！');
                    $("input[name='admin_image3']").val(res.data.url);
                }
            },
            error: function (returndata) {
                parent.layer.msg('数据异常', {
                    icon: 2,
                    time: 2000
                });
                return false;
            }
        });
    }


</script>

</body>
</html>